#include <string>
#include <iostream>

#include "Attribut.h"

using namespace std;

/**
* Constructeurs
*/
Attribut::Attribut() : Printer()
{
	name = "notNamed";
	type = "CDATA";
	option = "#IMPLIED";
}

Attribut::Attribut( const string& pname, const string& ptype, const string& poption ) : name(pname), 
type(ptype), option(poption)
{
}


/**
* Destructeur
*/
Attribut::~Attribut()
{
}

void Attribut::printMe()
{
	cout<< name << "\t" << type << "\t" << option<<" "<< getCardinalityString();;
}

const string& Attribut::getName() const
{
	return name;
}

const string& Attribut::getType() const
{
	return type;
}

const string& Attribut::getOption() const
{
	return option;
}

string Attribut::getCardinalityString()
{
	switch (cardinality) {
                case ONLY_ONE:
                        return "";
                case ZERO_OR_MORE:
                        return "*";
                case ONE_OR_MORE:
                        return "+";
                case OPTIONNAL:
                        return "?";
        }
        return "ERROR";

}

void Attribut::setCardinality(const CARDINALITY newCardinality)
{
        cardinality = newCardinality;
}


